import {FormControl, FormGroup} from '@angular/forms';

export function equalValidator(group: FormGroup): any {
  const pwd = group.get('password') as FormControl;
  const pwdConfirm = group.get('passwordConfirm') as FormControl;
  const valid = (pwd.value === pwdConfirm.value);
  return valid ? null : {equal: {msg: '两次输入的密码不一致'}};
}
